package com.yifeng.repo.flink.data.transport.config;

import java.time.Duration;

public class DataSourceConfigFactory {
	protected int fetchSize = JdbcSourceOptions.SCAN_SNAPSHOT_FETCH_SIZE.defaultValue();
    protected String serverTimeZone = JdbcSourceOptions.SERVER_TIME_ZONE.defaultValue();
    protected Duration connectTimeout = JdbcSourceOptions.CONNECT_TIMEOUT.defaultValue();
    protected int connectMaxRetries = JdbcSourceOptions.CONNECT_MAX_RETRIES.defaultValue();
    protected int connectionPoolSize = JdbcSourceOptions.CONNECTION_POOL_SIZE.defaultValue();
    
	public DataSourceConfig create() {
		DataSourceConfig dataSourceConfig = new DataSourceConfig();
		dataSourceConfig.setFetchSize(fetchSize);
		dataSourceConfig.setServerTimeZone(serverTimeZone);
		dataSourceConfig.setConnectTimeout(connectTimeout);
		dataSourceConfig.setConnectMaxRetries(connectMaxRetries);
		dataSourceConfig.setConnectionPoolSize(connectionPoolSize);
		return dataSourceConfig;
	}

}
